//
//  MPTDebugLiveView.m
//  MPTLive
//
//  Created by caixun on 15/8/20.
//  Copyright (c) 2015年 Jeakin. All rights reserved.
//

#import "MPTDebugLiveView.h"
#import "UIColor+MPTColor.h"
#import "UIFont+MPTFont.h"
#import "AnimateTools.h"
#import "SMPageControl.h"
#import "MPTLiveIMManager.h"


#pragma mark - ******************************** 公共宏 **********************************
// 距离屏幕左侧间距
#define Left_Space (20)
// 距离屏幕右侧间距
#define Right_Space (20)
// 距离屏幕底部间距
#define Footer_Space (20)

#pragma mark - ******************************** 直播按钮宏 **********************************
// 直播按钮的高度
#define StartLiveBtnH (44)
// 直播按钮的文字大小
#define StartLiveBtnFontSize (16.0f)
// 直播按钮的圆角弧度
#define StartLiveBtnRadius (22)

#pragma mark - ******************************** 提示文字宏 **********************************
// 提示文字的宽度
#define LabMessageW (207)
// 提示文字的高度
#define LabMessageH (37)
// 提示文字的字体大小
#define LabMessageFoneSize (17.0f)
// 提示文字的圆角弧度
#define LabMessageRadius (10)


@interface MPTDebugLiveView ()
{
    UISwipeGestureRecognizer *swipeXia;
    
    UISwipeGestureRecognizer *swipeShang;
    
    UISwipeGestureRecognizer *swipeZuo;
    
    UISwipeGestureRecognizer *swipeYou;
    
    /// 引导
    UIImageView *imageVXia;
    
    /// 引导
    UIImageView *imageVZuo;
    
    UIView *viewBeiJing;
}

// 开始直播按钮
@property (nonatomic, strong) UIButton *startLiveBtn;

@property (nonatomic, strong) UIView *viewPiFu;

@property (nonatomic, strong) UIImageView *imageVComeIn;

@property (nonatomic, strong) UIImageView *imageVComeOut;

@property (nonatomic, strong) SMPageControl *pageControlXia;

@property (nonatomic, strong) SMPageControl *pageControlZuo;

@property (nonatomic, strong) AnimateTools *animateTools;

@property (nonatomic, strong) NSArray *aryPiFuName;

@end


@implementation MPTDebugLiveView

#pragma mark - ***************************** View Lifecycle ***********************************

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.aryImages = [NSArray arrayWithObjects:@"PiFuDongRi",@"PiFuDongWu",@"PiFuLuXing",@"PiFuXinNian", nil];
        self.aryLuJing = [NSArray arrayWithObjects:@"MV_Filter_1_MeiYan",@"MV_Filter_3_BiKong",@"MV_Filter_5_RiXi",@"MV_Filter_6_QingTou",@"MV_Filter_7_WenYi", nil];
        self.aryPiFuName = @[@"冬天主题", @"动物主题", @"旅行主题", @"新年主题"];
        
        [self initMainViews];
    }
    return self;
}

-(void)willMoveToSuperview:(UIView *)newSuperview
{
    [super willMoveToSuperview:newSuperview];
    
    if(newSuperview == nil)
    {
        [[self subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
        
        return ;
    }
}


#pragma mark - ******************************** Init All Views **********************************

- (void)initMainViews
{
    // 调试页面的提示文字  产品说去掉了
//    CGRect messageRect = CGRectMake(0,0,LabMessageW,LabMessageH);
//    UILabel *labMessage = [[UILabel alloc] initWithFrame:messageRect];
//    labMessage.text = @"请调试你的镜头及闪光灯";
//    labMessage.textColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:1.0f];
//    labMessage.backgroundColor = [UIColor colorWithRed:28/255.0f green:28/255.0f blue:28/255.0f alpha:0.3];
//    labMessage.center = CGPointMake(self.center.x, self.center.y);
//    labMessage.font = [UIFont YXFontOfSize:LabMessageFoneSize];
//    labMessage.textAlignment = NSTextAlignmentCenter;
//    labMessage.layer.cornerRadius = LabMessageRadius;
//    labMessage.clipsToBounds = YES;
//    [self addSubview:labMessage];
    
    self.animateTools = [[AnimateTools alloc] init];
    
    /// 皮肤
    [self initPiFuViews];
    
    // 开始直播按钮
    CGRect startRect = CGRectMake(Left_Space,
                                   screenH-72-StartLiveBtnH,
                                   screenW-Left_Space-Right_Space,
                                   StartLiveBtnH);
    self.startLiveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.startLiveBtn.frame = startRect;
    [self.startLiveBtn setTitle:@"开始直播倒计时" forState:UIControlStateNormal];
    [self.startLiveBtn setBackgroundColor:[UIColor YXColorWithHexCode:@"#ffe200"]];
    [self.startLiveBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.startLiveBtn.layer.cornerRadius = StartLiveBtnRadius;
    self.startLiveBtn.titleLabel.font = [UIFont YXFontOfSize:StartLiveBtnFontSize];
    self.startLiveBtn.clipsToBounds = YES;
    [self addSubview:self.startLiveBtn];
    
    
    /// 底部遮罩
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.frame.size.height - 73, self.frame.size.width, 73)];
    imageV.userInteractionEnabled = YES;
    imageV.image = [UIImage imageNamed:@"dibuzhezhao"];
    [self addSubview:imageV];
    
    /// 分享按钮
    UIButton *butShare = [UIButton buttonWithType:UIButtonTypeCustom];
    butShare.frame =CGRectMake(Left_Space,
                               screenH-StartLiveBtnH - Footer_Space,
                               screenW-Left_Space-Right_Space,
                               StartLiveBtnH);
    [butShare addTarget:self action:@selector(butShareClicked:) forControlEvents:UIControlEventTouchUpInside
     ];
    butShare.adjustsImageWhenHighlighted = NO;
    [butShare setImage: [UIImage imageNamed:@"zhibofengxiang"]forState:UIControlStateNormal];
    [butShare setImage: [UIImage imageNamed:@"zhibofengxiang1"]forState:UIControlStateSelected];
    butShare.selected = YES;
    _isShare = YES;
    butShare.backgroundColor = [UIColor clearColor];
    [self addSubview:butShare];
    
    
}

/// 皮肤View初始化
- (void)initPiFuViews
{
    /// 适配屏幕
    CGRect rect;
    if (screenH == 480)
    {
        rect = CGRectMake(0, 0, 150, 150);
    }
    else if (screenH == 568)
    {
        rect = CGRectMake(0, 0, 240 , 240);
    }
    else
    {
        rect = CGRectMake(0, 0, 285 , 285);
    }
    
    /// 背景的View
    _viewPiFu = [[UIView alloc] initWithFrame:rect];
    _viewPiFu.backgroundColor = [UIColor clearColor];
    _viewPiFu.center = self.center;
    _viewPiFu.clipsToBounds = YES;
    [self addSubview:_viewPiFu];
    
    /// 左面的小点点
    _pageControlZuo = [[SMPageControl alloc] initWithFrame:CGRectMake(-self.frame.size.width / 2 + 10, screenH / 2, self.frame.size.width, 20)];
    _pageControlZuo.pageIndicatorImage = [UIImage imageNamed:@"diandianweixuanzhongzuo"];
    _pageControlZuo.userInteractionEnabled = NO;
    _pageControlZuo.numberOfPages = _aryImages.count + 1;
    _pageControlZuo.currentPageIndicatorImage = [UIImage imageNamed:@"diandianMeizuo"];
    _pageControlZuo.transform = CGAffineTransformMakeRotation(M_PI_2);
    [self addSubview:_pageControlZuo];
    
    /// 下面的点点
    _pageControlXia = [[SMPageControl alloc] initWithFrame:CGRectMake(0, screenH-72-StartLiveBtnH - 40, self.frame.size.width, 20)];
    _pageControlXia.pageIndicatorImage = [UIImage imageNamed:@"diandianweixuanzhong"];
    _pageControlXia.userInteractionEnabled = NO;
    _pageControlXia.numberOfPages = _aryLuJing.count + 1;
    _pageControlXia.currentPageIndicatorImage = [UIImage imageNamed:@"diandianMei"];
    [self addSubview:_pageControlXia];
    
    /// 第一次加个引导
    if (![[NSUserDefaults standardUserDefaults] objectForKey:@"isShow"])
    {
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isShow"];
        
        
        viewBeiJing = [[UIView alloc] initWithFrame:self.bounds];
        viewBeiJing.backgroundColor = [UIColor colorWithWhite:0 alpha:0.7];
        [self addSubview:viewBeiJing];
        
        UIImage *imageZuo = [UIImage imageNamed:@"pifuyindaozuo"];
        imageVZuo = [[UIImageView alloc] initWithFrame:CGRectMake(20, screenH / 2 - imageZuo.size.height / 2, imageZuo.size.width, imageZuo.size.height)];
        imageVZuo.image = imageZuo;
        [viewBeiJing addSubview:imageVZuo];
        
        UIImage *imageXia = [UIImage imageNamed:@"pifuyindaoxia"];
        imageVXia = [[UIImageView alloc] initWithFrame:CGRectMake((screenW -imageXia.size.width) / 2,
                                                                               CGRectGetMidY(_pageControlXia.frame) - imageXia.size.height - 5,
                                                                               imageXia.size.width,
                                                                               imageXia.size.height)];
        imageVXia.image = imageXia;
        [viewBeiJing addSubview:imageVXia];
    }

    
    
    
    
    if([MPTLiveIMManager sharedInstance].strPiFu == nil  || [[MPTLiveIMManager sharedInstance].strPiFu isEqualToString:@"-1"])
    {
        self.shangIndex = -1;
        self.xiaIndex = _aryImages.count;
    }
    else
    {
        self.shangIndex = [MPTLiveIMManager sharedInstance].strPiFu.intValue;
        self.xiaIndex = [MPTLiveIMManager sharedInstance].strPiFu.intValue;
        
        /// 点点的逻辑
        _pageControlZuo.currentPageIndicatorImage = [UIImage imageNamed:@"diandianxuanzhong"];
        _pageControlZuo.currentPage = _shangIndex + 1;
    }
    
    if([MPTLiveIMManager sharedInstance].strLuJing == nil ||  [[MPTLiveIMManager sharedInstance].strLuJing isEqualToString:@"-1"])
    {
        self.zuoIndex = -1;
        self.youIndex = _aryLuJing.count;
    }
    else
    {
        self.zuoIndex = [MPTLiveIMManager sharedInstance].strLuJing.intValue;
        self.youIndex = [MPTLiveIMManager sharedInstance].strLuJing.intValue;
        
        /// 点点的逻辑
        _pageControlXia.currentPageIndicatorImage = [UIImage imageNamed:@"diandianxuanzhong"];
        _pageControlXia.currentPage = _zuoIndex + 1;
    }
    
    /// 显示上次选的皮肤
    if (_shangIndex > -1 && _shangIndex < _aryImages.count)
    {
        _imageVComeOut = [[UIImageView alloc] initWithFrame:_viewPiFu.bounds];
        _imageVComeOut.image = [UIImage imageNamed:_aryImages[_shangIndex]];
        [_viewPiFu addSubview:_imageVComeOut];
    }
    
    /// 显示上次的滤镜
    if (_zuoIndex > - 1 && _zuoIndex < _aryLuJing.count)
    {
         [[NSNotificationCenter defaultCenter] postNotificationName:@"LuJing" object:_aryLuJing[self.zuoIndex]];
    }
    
    /// 向上手势
    swipeShang = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeShang:)];
    swipeShang.direction = UISwipeGestureRecognizerDirectionUp;
    [self addGestureRecognizer:swipeShang];
    
    swipeXia = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeXia:)];
    swipeXia.direction = UISwipeGestureRecognizerDirectionDown;
    [self addGestureRecognizer:swipeXia];
    
    swipeZuo = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeZuo:)];
    swipeZuo.direction = UISwipeGestureRecognizerDirectionLeft;
    [self addGestureRecognizer:swipeZuo];
    
    
    swipeYou = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeYou:)];
    swipeYou.direction = UISwipeGestureRecognizerDirectionRight;
    [self addGestureRecognizer:swipeYou];
}


#pragma mark - ****************************** ButtonClicked *********************************

/// 向上的方法
- (void)swipeShang:(UISwipeGestureRecognizer *)swipe
{
    /// 移除引导页
    [self removeViewBeiJing];
    
    swipeShang.enabled = NO;
    swipeXia.enabled = NO;
 
    UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(0, 157 * screenW / 375, self.frame.size.width, 30)];
    lable.font = [UIFont systemFontOfSize:21.0f];
    lable.textColor = RGBAllColor(0xffffff);
    lable.textAlignment = NSTextAlignmentCenter;
    [self addSubview:lable];
    
    long arrayCount = _aryImages.count - 1;
    if (self.shangIndex >= arrayCount)
    {
        lable.text = @"默认主题";
        [self.animateTools showLvJingAnimateWithView:lable withcompletion:nil];
        
        [AnimateTools showPiFuAnimateWithView:self.imageVComeOut withComeInView:nil withRunSpace:-_viewPiFu.bounds.size.height - 10 withcompletion:^(BOOL finished) {
            swipeShang.enabled = YES;
            swipeXia.enabled = YES;
            self.imageVComeOut = nil;
            self.shangIndex  = -1;
            self.xiaIndex = _aryImages.count;
        }];
    }
    else
    {
        lable.text =_aryPiFuName[self.shangIndex+1];
        [self.animateTools showLvJingAnimateWithView:lable withcompletion:nil];
        
        UIImage *image = [UIImage imageNamed:_aryImages[self.shangIndex+1]];
        self.imageVComeIn = [[UIImageView alloc] initWithFrame:CGRectMake(0, _viewPiFu.bounds.size.height, _viewPiFu.bounds.size.height, _viewPiFu.bounds.size.height)];
        self.imageVComeIn.image = image;
        [_viewPiFu addSubview:self.imageVComeIn];
        
        if (_imageVComeOut)
        {
            [AnimateTools showPiFuAnimateWithView:self.imageVComeOut withComeInView:self.imageVComeIn withRunSpace:-_viewPiFu.bounds.size.height - 10 withcompletion:^(BOOL finished) {
                self.imageVComeOut = self.imageVComeIn;
                swipeShang.enabled = YES;
                swipeXia.enabled = YES;
                
                self.shangIndex ++;
                self.xiaIndex = self.shangIndex;
            }];
        }
        else
        {
            [AnimateTools showPiFuAnimateWithView:nil withComeInView:self.imageVComeIn withRunSpace:-_viewPiFu.bounds.size.height - 10 withcompletion:^(BOOL finished) {
                self.imageVComeOut = self.imageVComeIn;
                swipeShang.enabled = YES;
                swipeXia.enabled = YES;
                
                self.shangIndex ++;
                self.xiaIndex = self.shangIndex;
            }];
        }
    }
    
    /// 点点的逻辑
    if (self.shangIndex >= arrayCount)
    {
        _pageControlZuo.currentPageIndicatorImage = [UIImage imageNamed:@"diandianMeizuo"];
        _pageControlZuo.currentPage = 0;
    }
    else
    {
        _pageControlZuo.currentPageIndicatorImage = [UIImage imageNamed:@"diandianxuanzhongzuo"];
        _pageControlZuo.currentPage = _shangIndex + 2;
    }
}

/// 向下的方法
- (void)swipeXia:(UISwipeGestureRecognizer *)swipe
{
    /// 移除引导页
    [self removeViewBeiJing];
    
    swipeShang.enabled = NO;
    swipeXia.enabled = NO;

    UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(0, 157 * screenW / 375, self.frame.size.width, 30)];
    lable.font = [UIFont systemFontOfSize:21.0f];
    lable.textColor = RGBAllColor(0xffffff);
    lable.textAlignment = NSTextAlignmentCenter;
    [self addSubview:lable];
    
    if (self.xiaIndex <= 0)
    {
        lable.text = @"默认主题";
        [self.animateTools showLvJingAnimateWithView:lable withcompletion:nil];
        
        [AnimateTools showPiFuAnimateWithView:self.imageVComeOut withComeInView:nil withRunSpace:_viewPiFu.bounds.size.height withcompletion:^(BOOL finished) {
            swipeShang.enabled = YES;
            swipeXia.enabled = YES;
            self.imageVComeOut = nil;
            
            self.xiaIndex = _aryImages.count;
            self.shangIndex = -1;
        }];
    }
    else
    {
        
        lable.text =_aryPiFuName[self.xiaIndex-1];
        [self.animateTools showLvJingAnimateWithView:lable withcompletion:nil];
        
        UIImage *image = [UIImage imageNamed:_aryImages[self.xiaIndex-1]];
        self.imageVComeIn = [[UIImageView alloc] initWithFrame:CGRectMake(0, -_viewPiFu.bounds.size.height, _viewPiFu.bounds.size.height, _viewPiFu.bounds.size.height)];
        self.imageVComeIn.image = image;
        [_viewPiFu addSubview:self.imageVComeIn];
        
        if (_imageVComeOut)
        {
            [AnimateTools showPiFuAnimateWithView:self.imageVComeOut withComeInView:self.imageVComeIn withRunSpace:_viewPiFu.bounds.size.height withcompletion:^(BOOL finished) {
                self.imageVComeOut = self.imageVComeIn;
                swipeShang.enabled = YES;
                swipeXia.enabled = YES;
                
                self.xiaIndex -- ;
                self.shangIndex = self.xiaIndex;
            }];
        }
        else
        {
            [AnimateTools showPiFuAnimateWithView:nil withComeInView:self.imageVComeIn withRunSpace:_viewPiFu.bounds.size.height withcompletion:^(BOOL finished) {
                self.imageVComeOut = self.imageVComeIn;
                swipeShang.enabled = YES;
                swipeXia.enabled = YES;
                
                self.xiaIndex --;
                self.shangIndex = self.xiaIndex;
            }];
        }
    }
    
    /// 点点的逻辑
    if (self.xiaIndex <= 0)
    {
        _pageControlZuo.currentPageIndicatorImage = [UIImage imageNamed:@"diandianMeizuo"];
        _pageControlZuo.currentPage = 0;
    }
    else
    {
        _pageControlZuo.currentPageIndicatorImage = [UIImage imageNamed:@"diandianxuanzhongzuo"];
        _pageControlZuo.currentPage = _xiaIndex;
    }
}

- (void)swipeZuo:(UISwipeGestureRecognizer *)swipe
{
    /// 移除引导页
    [self removeViewBeiJing];
    
//    swipeYou.enabled = NO;
//    swipeZuo.enabled = NO;
    
    UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(0, 157 * screenW / 375, self.frame.size.width, 30)];
    lable.font = [UIFont systemFontOfSize:21.0f];
    lable.textColor = RGBAllColor(0xffffff);
    lable.textAlignment = NSTextAlignmentCenter;
    [self addSubview:lable];
    
    long arrayCount = _aryLuJing.count - 1;
    /// 点点的逻辑
    if (self.zuoIndex >= arrayCount)
    {
        _pageControlXia.currentPageIndicatorImage = [UIImage imageNamed:@"diandianMei"];
        _pageControlXia.currentPage = 0;
    }
    else
    {
        _pageControlXia.currentPageIndicatorImage = [UIImage imageNamed:@"diandianxuanzhong"];
        _pageControlXia.currentPage = _zuoIndex + 2;
    }
    
    if (self.zuoIndex >= arrayCount)
    {
        lable.text = @"默认";
        [[NSNotificationCenter defaultCenter] postNotificationName:@"LuJing" object:nil];
        
        self.youIndex = _aryLuJing.count;
        self.zuoIndex = -1;
        [self.animateTools showLvJingAnimateWithView:lable withcompletion:^(BOOL finished) {
            [lable removeFromSuperview];
            swipeYou.enabled = YES;
            swipeZuo.enabled = YES;
        }];
    }
    else
    {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"LuJing" object:_aryLuJing[self.zuoIndex + 1]];
        
        if ([_aryLuJing[self.zuoIndex + 1] isEqualToString:@"MV_Filter_1_MeiYan"])
        {
            lable.text = @"美颜";
        }
        else if ([_aryLuJing[self.zuoIndex + 1] isEqualToString:@"MV_Filter_3_BiKong"])
        {
            lable.text = @"碧空";
        }
        else if ([_aryLuJing[self.zuoIndex + 1] isEqualToString:@"MV_Filter_5_RiXi"])
        {
            lable.text = @"日系";
        }
        else if ([_aryLuJing[self.zuoIndex + 1] isEqualToString:@"MV_Filter_6_QingTou"])
        {
            lable.text = @"清透";
        }
        else if ([_aryLuJing[self.zuoIndex + 1] isEqualToString:@"MV_Filter_7_WenYi"])
        {
            lable.text = @"文艺";
        }
        else
        {
            
        }
        
        self.zuoIndex ++ ;
        self.youIndex = self.zuoIndex;
        [self.animateTools showLvJingAnimateWithView:lable withcompletion:^(BOOL finished) {
            [lable removeFromSuperview];
            swipeYou.enabled = YES;
            swipeZuo.enabled = YES;
        }];
    }
}

- (void)swipeYou:(UISwipeGestureRecognizer *)swipe
{
    /// 移除引导页
    [self removeViewBeiJing];
//    swipeYou.enabled = NO;
//    swipeZuo.enabled = NO;
    
    UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(0, 157 * screenW / 375 , self.frame.size.width, 30)];
    lable.textColor = RGBAllColor(0xffffff);
    lable.font = [UIFont systemFontOfSize:21.0f];
    lable.textAlignment = NSTextAlignmentCenter;
    [self addSubview:lable];
    
    /// 点点的逻辑
    if (self.youIndex <= 0)
    {
        _pageControlXia.currentPageIndicatorImage = [UIImage imageNamed:@"diandianMei"];
        _pageControlXia.currentPage = 0;
    }
    else
    {
        _pageControlXia.currentPageIndicatorImage = [UIImage imageNamed:@"diandianxuanzhong"];
        _pageControlXia.currentPage = _youIndex;
    }
    
    if (self.youIndex <= 0)
    {
        lable.text = @"默认";
        [[NSNotificationCenter defaultCenter] postNotificationName:@"LuJing" object:nil];
        
        self.youIndex = _aryLuJing.count;
        self.zuoIndex = -1;
        [self.animateTools showLvJingAnimateWithView:lable withcompletion:^(BOOL finished) {
            [lable removeFromSuperview];
            swipeYou.enabled = YES;
            swipeZuo.enabled = YES;
        }];
    }
    else
    {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"LuJing" object:_aryLuJing[self.youIndex - 1]];
        
        if ([_aryLuJing[self.youIndex - 1] isEqualToString:@"MV_Filter_1_MeiYan"])
        {
            lable.text = @"美颜";
        }
        else if ([_aryLuJing[self.youIndex - 1] isEqualToString:@"MV_Filter_3_BiKong"])
        {
            lable.text = @"碧空";
        }
        else if ([_aryLuJing[self.youIndex - 1] isEqualToString:@"MV_Filter_5_RiXi"])
        {
            lable.text = @"日系";
        }
        else if ([_aryLuJing[self.youIndex - 1] isEqualToString:@"MV_Filter_6_QingTou"])
        {
            lable.text = @"清透";
        }
        else if ([_aryLuJing[self.youIndex - 1] isEqualToString:@"MV_Filter_7_WenYi"])
        {
            lable.text = @"文艺";
        }
        else
        {
            
        }
        
        self.youIndex -- ;
        self.zuoIndex = self.youIndex;
        [self.animateTools showLvJingAnimateWithView:lable withcompletion:^(BOOL finished) {
            [lable removeFromSuperview];
            swipeYou.enabled = YES;
            swipeZuo.enabled = YES;
        }];
    }
    
    
}

/// 点击分享按钮
- (void)butShareClicked:(UIButton *)but
{
    but.selected = !but.selected;
    _isShare = !_isShare;
}

#pragma mark - ****************************** Functions *********************************

- (void)removeViewBeiJing
{
    /// 移除引导页
    if (viewBeiJing)
    {
        [UIView animateWithDuration:0.3 animations:^{
            viewBeiJing.alpha = 0;
            imageVXia.alpha = 0;
            imageVZuo.alpha = 0;
        } completion:^(BOOL finished) {
            [imageVXia removeFromSuperview];
            [imageVZuo removeFromSuperview];
            [viewBeiJing removeFromSuperview];
        }];
    }
}

- (void)setTargetForBtn:(id)target
        withStartAction:(SEL)startAction
{
    
    [self.startLiveBtn addTarget:target action:startAction forControlEvents:UIControlEventTouchUpInside];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self removeViewBeiJing];
}

@end
